<%@page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="description" content="description of your site" />
    <meta name="author" content="author of the site" />
    <title>添加商品</title>
    <link rel="stylesheet" href="../css/bootstrap.css" />
    <link rel="stylesheet" href="../css/bootstrap-responsive.css" />
    <link rel="stylesheet" href="../css/styles.css" />
    <link rel="stylesheet" href="../css/toastr.css" />
    <link rel="stylesheet" href="../css/fullcalendar.css" />
    <script src="../js/jquery.min.js"></script>
    <script src="../js/bootstrap.js"></script>
    <script src="../js/jquery.knob.js"></script>
    <script src="../js/d3.v3.min.js"></script>
    <script src="../js/jquery.sparkline.min.js"></script>
    <script src="../js/toastr.js"></script>
    <script src="../js/jquery.tablesorter.min.js"></script>
    <script src="../js/jquery.peity.min.js"></script>
    <script src="../js/fullcalendar.min.js"></script>
    <script src="../js/gcal.js"></script>
    <script src="../js/setup.js"></script>
    <script>
        $(function (categories){
           $.get("findTheThirdGrade",function (categories){
               for (let i in categories){
                   let c = categories[i]
                   let option ="<option value='"+c.id+"'>"+c.categoryName+"</option>";
                   $(option).appendTo("#grade3");
               }
           })
        })
    </script>
    <script>
        function calMemberPrice(){
            var normalprice = document.getElementById("normalprice");
            var memberprice = document.getElementById("memberprice");
            document.getElementById("memberprice").value= normalprice.value*0.8;
        }
    </script>
</head>
<body>

<!-- header部分 -->
<%@include file="../header.jsp"%>
<div class="page">
    <div class="page-container">
        <div class="container">
            <div class="row">
                <div class="span12">
                    <h4 class="header">添加新品</h4>
                    <form action="insertProducts" method="post" enctype="multipart/form-data">
                        <table class="table table-striped sortable">
                            <thead>
                            </thead>
                            <tbody>
                            <tr>
                                <th>商品名称</th>
                                <td><input type="text" name="productName"/></td>
                            </tr>
                            <tr>
                                <th>商品描述</th>
                                <td><textarea cols="20" rows="5" name="productDescription"></textarea></td>
                            </tr>
                            <tr>
                                <th>普通价格</th>
                                <td>&yen;<input id="normalprice" type="text" name="productNormalPrice" onblur="calMemberPrice()"/>元</td>
                            </tr>
                            <tr>
                                <th>会员价格</th>
                                <td>&yen;<input id="memberprice" name="productMemberPrice" type="text" readonly="readonly"/>元</td>
                            </tr>
                            <tr>
                                <th>商品图片</th>
                                <td><input type="file" name="file" />上传图片</td>
                            </tr>
                            <tr>
                                <th>商品类别</th>
                                <td>
                                    <select id="grade3" name="productCatagoryid">
                                    </select>
                                </td>
                            </tr>

                            <tr>
                                <td></td>
                                <td><input class="btn btn-success" type="submit"
                                           value="添加" />&nbsp;&nbsp;&nbsp;<input class="btn btn-danger"
                                                                                 type="reset" value="重置" /></td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="../footer.jsp"%>
</body>
</html>
